#ifndef TILE_H
#define TILE_H

#include <SFML/Graphics.hpp>
#include <SFML/Graphics/Rect.hpp>
#include <iostream>

#include "globals.h"
#include "hexBinConverter.h"

class Tile
{
public:
	/// Name:		 Default Constructor
	/// Description: Initualizes a Tile correctly  with default settings
	/// Param(s):	 (void)
	/// Return(s):	 (void) returns nothing
	Tile();

	/// Name:		 Copy Constructor
	/// Description: Initualizes a Tile correctly
	/// Param(s):	 (Tile&) a reference to a Tile object
	/// Return(s):	 (void) returns nothing
	Tile( Tile& tile );

	/// Name:		 Assignment Operator
	/// Description: assigneds a tile from the right hand side to the
	///				 left hand side
	/// Param(s):	 (Tile&) a reference to a tile object
	/// Return(s):	 (void) returns nothing
	Tile& operator = ( const Tile& rhs );

	/// Name:		 Destructor
	/// Description: handles the destruction of this object
	/// Param(s):	 none
	/// Return(s):	 (void) returns nothing
	~Tile();

	/// Name:		 setImageName
	/// Description: sets image name and loads image and sprites
	/// Param(s):	 std::string
	/// Return(s):	 (void) returns nothing
	void setImageName( std::string imageName );

	/// Name:		 setImageNameAndLocation
	/// Description: sets image name and location to ImageNameAndLocation
	/// Param(s):	 std::string
	/// Return(s):	 (void) returns nothing
	void setImageNameAndLocation( std::string location );

	/// Name:		 setCollision
	/// Description: sets the member variable collision
	/// Param(s):	 none
	/// Return(s):	 (void) returns nothing
	void setCollision( bool collision );

	/// Name:		 setNumber
	/// Description: sets the member variable number
	/// Param(s):	 none
	/// Return(s):	 (void) returns nothing
	void setNumber( unsigned int number );

	/// Name:		 setHex
	/// Description: sets the hex string with the passed string
	/// Param(s):	 std::string
	/// Return(s):	 (void) returns nothing
	void setHex( std::string hex );

	/// Name:		 setBin
	/// Description: sets the binary string with the passed string
	/// Param(s):	 std::string
	/// Return(s):	 (void) returns nothing
	void setBin( std::string bin );

	/// Name:		 setRect
	/// Description: sets the rects top bottom left and right
	///				 and the sprites top and left
	/// Param(s):	 float top, float bottom, float left, float right
	/// Return(s):	 (void) returns nothing
	void setRect( float top, float bottom, float left, float right );

	/// Name:		 getImageName
	/// Description: gets the image name of this tile
	/// Param(s):	 none
	/// Return(s):	 std::string
	std::string getImageName();

	/// Name:		 getImageName
	/// Description: gets the image name and directory from the root of the 
	///				 executable of this tile
	/// Param(s):	 none
	/// Return(s):	 std::string
	std::string getImageNameAndLocation();

	/// Name:		 getCollision
	/// Description: returns whether a Tile is collidable or not
	/// Param(s):	 none
	/// Return(s):	 bool collidable = true NON-collidable = false
	bool getCollision();

	/// Name:		 getNumber
	/// Description: gets the tile number corrisponding to its position
	///				 in the TileImageName vector.
	/// Param(s):	 none
	/// Return(s):	 unsigned int returns a number between 1-128
	unsigned int getNumber();

	/// Name:		 getHex
	/// Description: returns the hex string of this Tile
	/// Param(s):	 none
	/// Return(s):	 std::string returns the object's hex string
	std::string getHex();

	/// Name:		 getBin
	/// Description: returns the binary string of this Tile
	/// Param(s):	 none
	/// Return(s):	 std::string returns the object's binary string
	std::string getBin();

	/// Name:		 getRect
	/// Description: Returns the Tiles rect
	/// Param(s):	 none
	/// Return(s):	 sf::Rect<float>
	sf::Rect<float> getRect();

	/// Name:		 getImage
	/// Description: Returns the Tiles image
	/// Param(s):	 none
	/// Return(s):	 sf::Image
	sf::Image getImage();

	/// Name:		 getSprite
	/// Description: Returns the Tiles sprite
	/// Param(s):	 none
	/// Return(s):	 sf::Sprite
	sf::Sprite getSprite();
private:
	/// the name of the image file which corrisponds to this tile
	std::string imageName;

	/// the name and location of the image file for this tile
	std::string imageNameAndLocation;

	/// true sets collision false create passive
	bool collision;

	/// the number which corrisponds to the position in 
	/// the vector which holds the imageNames for the map
	int number;

	/// holds a hex string which is a compressed number
	/// that holds information about the tiles attributes
	std::string bin;

	/// holds a binary string which gets compressed into
	/// a hex number for writing to the map file
	std::string hex;

	/// holds the image of the tile
	sf::Image image;

	/// holds the sprite of the tile
	sf::Sprite sprite;

	/// holds the logical rectangle bonderies
	sf::Rect<float> rect;
};
#endif /// TILE_H